local liyong = fk.CreateSkill{
  name = "klmou__liyong",
  tags = { Skill.Limited },
}

Fk:loadTranslationTable{
  ["klmou__liyong"] = "厉勇",
  [":klmou__liyong"] = "限定技，当你进入濒死状态时，你可以将体力回复至X点并摸等量张牌（X为你体力上限的一半且向上取整），然后你结束当前角色的回合，且你立即执行一个额外的出牌阶段。",

  ["$klmou__liyong1"] = "贼众百万，吾亦不放在眼里。",
  ["$klmou__liyong2"] = "吾，以一敌千，放马过来吧！",
}

liyong:addEffect(fk.EnterDying, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(liyong.name) and player:usedSkillTimes(liyong.name, Player.HistoryGame) == 0
  end,
  on_cost = function (self, event, target, player, data)
    local num = math.ceil(player.maxHp / 2)
    if player.room:askToSkillInvoke(player, {
      skill_name = liyong.name,
      prompt = "厉勇：你可以回复体力至" .. num .. "点并摸等量牌，然后结束当前回合并立即执行一个额外的出牌阶段",
    }) then
      event:setCostData(self,{ num = num })
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local num = event:getCostData(self).num
    if player:isWounded() then
      room:recover {
        num = num - player.hp,
        skillName = liyong.name,
        who = player,
        recoverBy = player,
      }
    end
    player:drawCards(num, liyong.name)
    if player.dead then return end
    player:gainAnExtraPhase(Player.Play, liyong.name, false)
    room.logic:breakTurn()
  end,
})


return liyong
